package com.ase.mobile.utils.result;

/**
 * @author gyhstart
 * @create 2021/5/23 - 3:41
 *
 * 各种情况相对应的返回数据模板（工具类）
 **/
public class ResUtils {
    public static Result success(Object data) {
        Result<Object> result = new Result<>();
        result.setCode(Status.SUCCESS.getCode());
        result.setMsg(Status.SUCCESS.getMsg());
        result.setData(data);
        return result;
    }

    public static Result failure(Object data) {
        Result<Object> result = new Result<>();
        result.setCode(Status.FAILURE.getCode());
        result.setMsg(Status.FAILURE.getMsg());
        result.setData(data);
        return result;
    }

    public static Result unknown_error() {
        Result<Object> result = new Result<>();
        result.setCode(Status.UNKNOWN_ERROR.getCode());
        result.setMsg(Status.UNKNOWN_ERROR.getMsg());
        return result;
    }
}
